#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int year = 0;
    int time = 0;
    double wage = 0;
    scanf("%d %d", &year, &time);
    if (year >= 5)
    {
        if (time <= 40)
            wage = 50 * time;
        else
            wage = 50 * 1.5 * (time - 40) + 40 * 50;
    }
    else
    {
        if (time <= 40)
            wage = 30 * time;
        else
            wage = 30 * 1.5 * (time - 40) + 30 * 40;
    }
    printf("%.2lf", wage);
    return 0;
}